home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / lib2to3 / fixes / fix_reduce.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.2 KB  |  20 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''Fixer for reduce().
  5.  
  6. Makes sure reduce() is imported from the functools module if reduce is
  7. used in that module.
  8. '''
  9. from  import pytree
  10. from  import fixer_base
  11. from fixer_util import Name, Attr, touch_import
  12.  
  13. class FixReduce(fixer_base.BaseFix):
  14.     PATTERN = "\n    power< 'reduce'\n        trailer< '('\n            arglist< (\n                (not(argument<any '=' any>) any ','\n                 not(argument<any '=' any>) any) |\n                (not(argument<any '=' any>) any ','\n                 not(argument<any '=' any>) any ','\n                 not(argument<any '=' any>) any)\n            ) >\n        ')' >\n    >\n    "
  15.     
  16.     def transform(self, node, results):
  17.         touch_import('functools', 'reduce', node)
  18.  
  19.  
  20.